package br.edu.ufcg.ga.parser.args.group;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.jgap.Configuration;
import org.jgap.InvalidConfigurationException;
import org.jgap.impl.WeightedRouletteSelector;

public class NSweightedRouletteSelectorGroupBuilder extends AbstractMyGroupBuilder {

	private Option NSweightedRouletteSelector;

	@SuppressWarnings("static-access")
	@Override
	protected void init() {
		NSweightedRouletteSelector = OptionBuilder.withDescription(
				"Seleciona os cromossomos usando uma roleta baseada no fitness").withLongOpt(
				"NSweightedRouletteSelector").create("WRS");

	}

	@Override
	public void configSafely(Configuration config, CommandLine commandLine) throws InvalidConfigurationException {
		WeightedRouletteSelector ns = new WeightedRouletteSelector(config);
		config.addNaturalSelector(ns, true);
	}

	@Override
	protected Option getMainOption() {
		return this.NSweightedRouletteSelector;
	}

	@Override
	protected Option[] getOtherOptions() {
		return new Option[]{};
	}

}
